SoapClient
PHP Manual

SoapClient::__setSoapHeaders

(PHP 5 >= 5.0.5)

SoapClient::__setSoapHeadersSets SOAP headers for subsequent calls.

Descripción

public bool SoapClient::__setSoapHeaders ([ mixed $soapheaders ] )

Defines headers to be sent along with the SOAP requests.

Note: Calling this method will replace any previous values.

Lista de parámetros

soapheaders

The headers to be set. If not specified, the headers will be deleted.

Valores retornados

Devuelve TRUE si todo se llevó a cabo correctamente, FALSE en caso de fallo.

Ejemplos

Example #1 SoapClient::__setSoapHeaders() example

<?php

$client 
= new SoapClient(null, array('location' => "http://localhost/soap.php",
                                     
'uri'      => "http://test-uri/"));
$header = new SoapHeader('http://soapinterop.org/echoheader/'
                            
'echoMeStringRequest',
                            
'hello world');

$client->__setSoapHeaders($header);

$client->__soapCall("echoVoid"null);
?>

Example #2 Set Multiple Headers

<?php

$client 
= new SoapClient(null, array('location' => "http://localhost/soap.php",
                                     
'uri'      => "http://test-uri/"));
$headers = array();

$headers[] = new SoapHeader('http://soapinterop.org/echoheader/'
                            
'echoMeStringRequest',
                            
'hello world');

$headers[] = new SoapHeader('http://soapinterop.org/echoheader/'
                            
'echoMeStringRequest',
                            
'hello world again');

$client->__setSoapHeaders($headers);

$client->__soapCall("echoVoid"null);
?>


SoapClient
PHP Manual